package com.osdp.auth.rest;

import com.osdp.auth.server.IAuthService;
import com.osdp.auth.server.ITokenService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

@RestController
@RequestMapping("/v1/rest")
@Api(tags = "Feign接口管理")
@Slf4j
public class AuthServiceRest {


    @Autowired
    private ITokenService tokenService;

    /**
     * 刷新token
     *
     * @param token
     * @return
     */
    @GetMapping("/auth/token/refresh")
    public boolean refresh(@RequestParam("token") String token){
        return tokenService.refresh(token);
    }

    /**
     * 验证token
     * @param token
     * @return
     */
    @GetMapping("/auth/token/verify")
    public boolean verify(@RequestParam("token") String token){
        return tokenService.verify(token);
    }

}
